package com.cn.web.user.vo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cn.card.IDCardCheck;
import com.cn.common.IDGenerate;
import com.cn.empty.EmptyCheck;
import com.cn.group.GroupDO;
import com.cn.validate.JsonSerializerPhone;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * description: UserVO <br>
 * date: 21.12.16 10:15 <br>
 * author: cn_yaojin <br>
 * version: 1.0 <br>
 */

@Setter
@Getter
@Accessors(chain = true)
@ApiModel(value = "中台用户Vo")
public class UserVO extends IDGenerate {

    //业务中台用户主键
    @ExcelIgnore
    private String userId;

    @ExcelIgnore
    @ApiModelProperty(value = "用户名")
    private String accountName;

    @ApiModelProperty(value = "昵称")
    private String nickName;

    @ExcelProperty(value = "姓名")
    @EmptyCheck(message = "姓名不能为空", max = 30)
    @ApiModelProperty(value = "姓名")
    private String userName;

    @JsonSerialize(using = JsonSerializerPhone.class)
    @ExcelProperty(value = "手机号")
    @ApiModelProperty(value = "手机号")
    private String phone;

    @ExcelProperty(value = "用户类型")
    @ApiModelProperty(value = "用户类型")
    private String userItemType;

    @ExcelIgnore
    @IDCardCheck(message = "身份证格式错误")
    @ApiModelProperty(value = "身份证号")
    private String cardNum;

    @ExcelProperty(value = "工号")
    @ApiModelProperty(value = "工号")
    private String workNum;

    @ExcelProperty(value = "职位")
    @ApiModelProperty(value = "职位")
    private String workPost;

    @ExcelProperty(value = "用户状态")
    @ApiModelProperty(value = "0-正常 1-停用")
    private String userStatus;

    @ExcelProperty(value = "创建时间")
    @ApiModelProperty(value = "创建时间")
    private String addTime;

    @ExcelProperty(value = "备注")
    @ApiModelProperty(value = "备注")
    private String remark;

    @ExcelIgnore
    private String addName;

    @ExcelIgnore
    @ApiModelProperty(value = "头像")
    private String photo;

    @ExcelIgnore
    @ApiModelProperty(value = "角色")
    private List<UserRoles> roles;

    @ExcelIgnore
    @ApiModelProperty(value = "单位")
    private List<UserUnits> units;

    @ExcelIgnore
    @ApiModelProperty(value = "分组")
    private List<GroupDO> groups;

    @Getter
    @Setter
    @ToString
    @Accessors(chain = true)
    public static class UserRoles {
        @ApiModelProperty(value = "角色主键")
        private String id;
        @ApiModelProperty(value = "角色名称")
        private String roleName;
    }

    @Getter
    @Setter
    @ToString
    @Accessors(chain = true)
    public static class UserUnits {
        @ApiModelProperty(value = "单位主键")
        private String id;
        @ApiModelProperty(value = "单位名称")
        private String orgName;
    }
}
